/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "clearing_price")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ClearingPrice.findAll", query = "SELECT c FROM ClearingPrice c"),
    @NamedQuery(name = "ClearingPrice.findById", query = "SELECT c FROM ClearingPrice c WHERE c.id = :id"),
    @NamedQuery(name = "ClearingPrice.findByClearingDate", query = "SELECT c FROM ClearingPrice c WHERE c.clearingDate = :clearingDate"),
    @NamedQuery(name = "ClearingPrice.findByRegionID", query = "SELECT c FROM ClearingPrice c WHERE c.regionID = :regionID"),
    @NamedQuery(name = "ClearingPrice.findByObj", query = "SELECT c FROM ClearingPrice c WHERE c.obj = :obj"),
    @NamedQuery(name = "ClearingPrice.findByClassCode", query = "SELECT c FROM ClearingPrice c WHERE c.classCode = :classCode"),
    @NamedQuery(name = "ClearingPrice.findByMarketCode", query = "SELECT c FROM ClearingPrice c WHERE c.marketCode = :marketCode"),
    @NamedQuery(name = "ClearingPrice.findByClosePrice", query = "SELECT c FROM ClearingPrice c WHERE c.closePrice = :closePrice"),
    @NamedQuery(name = "ClearingPrice.findByClearprice", query = "SELECT c FROM ClearingPrice c WHERE c.clearprice = :clearprice"),
    @NamedQuery(name = "ClearingPrice.findByALCPrice", query = "SELECT c FROM ClearingPrice c WHERE c.aLCPrice = :aLCPrice"),
    @NamedQuery(name = "ClearingPrice.findByOwnUserID", query = "SELECT c FROM ClearingPrice c WHERE c.ownUserID = :ownUserID"),
    @NamedQuery(name = "ClearingPrice.findByAlterUserID", query = "SELECT c FROM ClearingPrice c WHERE c.alterUserID = :alterUserID"),
    @NamedQuery(name = "ClearingPrice.findByCreateTime", query = "SELECT c FROM ClearingPrice c WHERE c.createTime = :createTime"),
    @NamedQuery(name = "ClearingPrice.findByTimeStamp", query = "SELECT c FROM ClearingPrice c WHERE c.timeStamp = :timeStamp")})
public class ClearingPrice implements Serializable {
	public static byte[] EnCode(ClearingPrice msg) throws IOException {
		Codec<ClearingPrice> Lcode = ProtobufProxy.create(ClearingPrice.class);
		return Lcode.encode(msg);
	}
	public static ClearingPrice DeCode(byte[] data) throws IOException {
	Codec<ClearingPrice> Lcode = ProtobufProxy.create(ClearingPrice.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Column(name = "ClearingDate")
    @Temporal(TemporalType.DATE)
    private Date clearingDate;
	@Protobuf
	private long clearingDateL;
    @Column(name = "RegionID")
    @Protobuf
	private String regionID;
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Basic(optional = false)
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Basic(optional = false)
    @Column(name = "ClosePrice")
    @Protobuf
	private float closePrice;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "clearprice")
    @Protobuf
	private Float clearprice;
    @Basic(optional = false)
    @Column(name = "ALCPrice")
    @Protobuf
	private float aLCPrice;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public ClearingPrice() {
    }

    public ClearingPrice(Integer id) {
        this.id = id;
    }

    public ClearingPrice(Integer id, String obj, String classCode, String marketCode, float closePrice, float aLCPrice) {
        this.id = id;
        this.obj = obj;
        this.classCode = classCode;
        this.marketCode = marketCode;
        this.closePrice = closePrice;
        this.aLCPrice = aLCPrice;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getClearingDate() {
        return clearingDate;
    }

    public void setClearingDate(Date clearingDate) {
        this.clearingDate = clearingDate;
        this.setClearingDateL(CodeTool.DateToLong(clearingDate));
    }

    public String getRegionID() {
        return regionID;
    }

    public void setRegionID(String regionID) {
        this.regionID = regionID;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public float getClosePrice() {
        return closePrice;
    }

    public void setClosePrice(float closePrice) {
        this.closePrice = closePrice;
    }

    public Float getClearprice() {
        return clearprice;
    }

    public void setClearprice(Float clearprice) {
        this.clearprice = clearprice;
    }

    public float getALCPrice() {
        return getaLCPrice();
    }

    public void setALCPrice(float aLCPrice) {
        this.setaLCPrice(aLCPrice);
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClearingPrice)) {
            return false;
        }
        ClearingPrice other = (ClearingPrice) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.ClearingPrice[ id=" + id + " ]";
    }

    public long getClearingDateL() {
        return clearingDateL;
    }

    public void setClearingDateL(long clearingDateL) {
        this.clearingDateL = clearingDateL;
		this.clearingDate = CodeTool.LongToDate(clearingDateL);
    }

    public float getaLCPrice() {
        return aLCPrice;
    }

    public void setaLCPrice(float aLCPrice) {
        this.aLCPrice = aLCPrice;
    }
    
}
